﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FrameWork.Lib;
using System.ComponentModel;

namespace FrameWork.WinUI
{
    public class EventManagerBase
    {
        public delegate void DelegateAddResult(Result pResult);
        public DelegateAddResult AddResult;
        [DefaultValue(FrameWork.Lib.ResultSeverityType.Critical)]
        public FrameWork.Lib.ResultSeverityType AddResultSeverityLevel { get; set; }

        public delegate void DelegateUpdateProgress(Guid pKey, int pTotal, int pCurrent, string pDescription);
        public DelegateUpdateProgress UpdateProgress;

        public void CheckedAddResult(Result pResult)
        {
            if (pResult.Message.HasValue() && pResult.Severity <= AddResultSeverityLevel)
            {
                AddResult(pResult);
            }
        }
    }
}
